﻿@model CategoryModel
@{
    Layout = "~/Views/Shared/_ColumnsTwo3.cshtml";
    Html.AddTitleParts(!String.IsNullOrEmpty(Model.MetaTitle) ? Model.MetaTitle : Model.Name);
    Html.AddMetaDescriptionParts(Model.MetaDescription);
    Html.AddMetaKeywordParts(Model.MetaKeywords);

    var canonicalUrlsEnabled = EngineContext.Current.Resolve<SeoSettings>().CanonicalUrlsEnabled;
    if (canonicalUrlsEnabled)
    {
        var categoryUrl = Url.RouteUrl("Category", new { categoryId = Model.Id, SeName = Model.SeName }, this.Request.Url.Scheme);
        Html.AddCanonicalUrlParts(categoryUrl);
    }
}
@using Nop.Core;
@using Nop.Core.Domain.Common;
@using Nop.Core.Infrastructure;
@using Nop.Web;
@using Nop.Web.Framework;
@using Nop.Web.Framework.UI;
@using Nop.Web.Models.Catalog;
@using Nop.Web.Extensions;
<div class="category-page">

    @*category breadcrumb*@
    @if (Model.DisplayCategoryBreadcrumb)
    {
        <div class="breadcrumb">
            <a href="@Url.RouteUrl("HomePage")">@T("Categories.Breadcrumb.Top")</a> /
            @for (int i = 0; i < Model.CategoryBreadcrumb.Count; i++)
            {
                var catBr = Model.CategoryBreadcrumb[i];
                <a href="@Url.RouteUrl("Category", new { categoryId = catBr.Id, SeName = catBr.SeName })">@catBr.Name</a>
                if (i != Model.CategoryBreadcrumb.Count - 1)
                {
                    <text>/</text>
                }
            }
            <br />
        </div>
        <div class="clear">
        </div>
    }
    


    @*description*@
    <div class="category-description">
        @Html.Raw(Model.Description)
    </div>
    <div class="clear">
    </div>


    
    @*subcategories*@
    @if (Model.SubCategories.Count > 0)
    {
        <div class="sub-category-grid">
            @(Html.DataList<CategoryModel.SubCategoryModel>(Model.SubCategories, 4,
                @<div class="item-box">
                    <div class="sub-category-item">
                        <h2 class="category-title">
                            <a href="@Url.RouteUrl("Category", new { categoryId = item.Id, SeName = item.SeName })" title="@item.PictureModel.Title">
                                @item.Name</a>
                        </h2>
                        <div class="picture">
                            <a href="@Url.RouteUrl("Category", new { categoryId = item.Id, SeName = item.SeName })" title="@item.PictureModel.Title">
                                <img alt="@item.PictureModel.AlternateText" src="@item.PictureModel.ImageUrl"
                                    title="@item.PictureModel.Title" /></a>
                        </div>
                    </div>
                </div>
            ))
        </div>
        <div class="clear">
        </div>
    }


    
    @*featured products*@
    @if (Model.FeaturedProducts.Count > 0)
    {
        <div class="featured-product-grid">
            <div class="title">
                @T("Products.FeaturedProducts")
            </div>
            <div>
                @(Html.DataList<ProductModel>(Model.FeaturedProducts, 3,
                    @<div class="item-box">
                        @Html.Partial("_ProductBox", @item)
                    </div>
                ))
            </div>
        </div>
        <div class="clear">
        </div>
    }
    
    
    
    
    @*view mode*@
    @if (Model.PagingFilteringContext.AllowProductViewModeChanging && Model.Products.Count > 0)
    {
        <div class="product-viewmode">
            <span>@T("Categories.ViewMode")</span>
            @Html.DropDownList("products-viewmode", Model.PagingFilteringContext.AvailableViewModes, new { onchange = "setLocation(this.value);"})
        </div>
    }   
    
    
    @*sorting*@
    @if (Model.PagingFilteringContext.AllowProductSorting && Model.Products.Count > 0)
    {
        <div class="product-sorting">
            <span>@T("Categories.OrderBy")</span>
            @Html.DropDownList("products-orderby", Model.PagingFilteringContext.AvailableSortOptions, new { onchange = "setLocation(this.value);" })
        </div>
    }
    
    @*page size*@
    @if (Model.PagingFilteringContext.AllowCustomersToSelectPageSize && Model.Products.Count > 0)
    {
        <div class="product-page-size">
            <span>@T("Categories.PageSize")</span>
            <span>@Html.DropDownList("products-pagesize", Model.PagingFilteringContext.PageSizeOptions, new { onchange = "setLocation(this.value);" })</span>
            <span>@T("Categories.PageSize.PerPage")</span>
        </div>
    }
    <div class="clear">
    </div>
    
    @*filtering*@
    @if (Model.PagingFilteringContext.PriceRangeFilter.Enabled ||
        Model.PagingFilteringContext.SpecificationFilter.Enabled)
    {
        <div class="product-filters">
            <div class="filter-title">
                <span>@T("Filtering.FilterResults")</span>
            </div>
            <div class="filter-item">
                @Html.Partial("_FilterPriceBox", Model.PagingFilteringContext.PriceRangeFilter, new ViewDataDictionary())
            </div>
            <div class="filter-item">
                @Html.Partial("_FilterSpecsBox", Model.PagingFilteringContext.SpecificationFilter, new ViewDataDictionary())
            </div>
        </div>
        <div class="clear">
        </div>
    }
    
    
    
    
    @*product list*@
    @if (Model.Products.Count > 0)
    {
        if (Model.PagingFilteringContext.ViewMode == "list")
        {
            @*list mode*@
            <div class="product-list">
            @foreach (var product in Model.Products)
            {
                <div class="item-box">
                    @Html.Partial("_ProductBox", product)
                </div>
            }
            </div>       
        }
        else
        {
            @*grid mode*@
            <div class="product-grid">
                @(Html.DataList<ProductModel>(Model.Products, 3,
                    @<div class="item-box">
                        @Html.Partial("_ProductBox", @item)
                    </div>
                ))
            </div>
        }
    }
    
    <div class="clear">
    </div> 
    
    <div class="pager">
    @Html.Pager(Model.PagingFilteringContext).QueryParam("pagenumber")
    </div>
</div>
